#include "aboutdialog.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QPixmap>

AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
{
    setWindowTitle("关于 LINUX网络连接管理器");
    setFixedSize(600, 350);
    
    // 设置窗口图标
    QPixmap windowIcon(":/icons/resources/logo.png");
    if (!windowIcon.isNull()) {
        setWindowIcon(QIcon(windowIcon));
    }
    
    QVBoxLayout *layout = new QVBoxLayout(this);
    
    QLabel *iconLabel = new QLabel(this);
    QPixmap icon(":/icons/resources/logo.png");
    if (!icon.isNull()) {
        iconLabel->setPixmap(icon.scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
    } else {
        iconLabel->setText("图标加载失败");
    }
    iconLabel->setAlignment(Qt::AlignCenter);
    layout->addWidget(iconLabel);
    
    QLabel *titleLabel = new QLabel("<b>LINUX网络连接管理器</b>", this);
    titleLabel->setAlignment(Qt::AlignCenter);
    titleLabel->setStyleSheet("font-size: 18px;");
    layout->addWidget(titleLabel);
    
    QLabel *versionLabel = new QLabel("版本号：1.0.0", this);
    versionLabel->setAlignment(Qt::AlignCenter);
    layout->addWidget(versionLabel);
    
    QLabel *descLabel = new QLabel(
        "本软件是一款仿Windows风格的网络连接管理器，\n"
        "支持以太网、桥接、绑定等多种网络管理功能，\n"
        "为LINUX用户提供直观、易用的网络配置体验。", this);
    descLabel->setAlignment(Qt::AlignCenter);
    descLabel->setWordWrap(true);
    layout->addWidget(descLabel);
    
    QLabel *contactLabel = new QLabel("服务与支持团队：https://github.com/btwise/linux-netmanager", this);
    contactLabel->setAlignment(Qt::AlignCenter);
    layout->addWidget(contactLabel);

    QLabel *copyrightLabel = new QLabel("Copyright © 2025 BTWISE", this);
    copyrightLabel->setAlignment(Qt::AlignCenter);
    layout->addWidget(copyrightLabel);

    QLabel *authorLabel = new QLabel("作者：BTWISE   微信：15242609", this);
    authorLabel->setAlignment(Qt::AlignCenter);
    layout->addWidget(authorLabel);

    
    QPushButton *closeBtn = new QPushButton("关闭", this);
    connect(closeBtn, &QPushButton::clicked, this, &QDialog::accept);
    layout->addWidget(closeBtn);
    
    layout->setStretch(3, 1);
    setLayout(layout);
}